<include file="public:header" />
<!--菜单添加-->
<ul id="mytab" class="nav nav-tabs" style="margin-top: 15px;">
    <li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>
    <li class="active"><a href="#con1" data-toggle="tab">站点设置</a></li>
    <li><a href="#con2" data-toggle="tab">邮件设置</a></li>
    <li><a href="#con3" data-toggle="tab">公司信息</a></li>
</ul>
<div id="tabContent" class="tab-content">
    <div class="tab-pane fade in active" id="con1">
        <div style="margin-top: 20px;">
            <form class="form-horizontal" role="form" id="setting_site_form" action="{:u('superadmin/settings/index')}" method="post">

                <div class="form-group">
                    <label class="col-sm-1 control-label label-form">网站Title:</label>
                    <div class="col-sm-3 input-padding">
                        <input type="text" class="form-control" value="{$list.setting_site_title.data}" name="setting_site_title" id="setting_site_title"
                               placeholder="请输入网站Title">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-1 control-label label-form">网站关键字:</label>
                    <div class="col-sm-3 input-padding">
                        <input type="text" class="form-control" value="{$list.setting_site_keywords.data}" name="setting_site_keywords" id="setting_site_keywords"
                               placeholder="请输入网站关键字">
                    </div>
                </div>

                <div class="form-group">
                <label class="col-sm-1 control-label label-form">描述:</label>
                <div class="col-sm-3 input-padding">
                <textarea class="form-control" rows="3" name="setting_site_desc" placeholder="请输入网站描述">{$list.setting_site_desc.data}</textarea>
                </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-1 control-label label-form">网站域名:</label>
                    <div class="col-sm-3 input-padding">
                        <input type="text" class="form-control" value="{$list.setting_site_domain.data}" name="setting_site_domain" id="setting_site_domain"
                               placeholder="请输入网站域名">
                    </div>
                </div>

                <!--<div class="form-group">-->
                    <!--<label class="col-sm-1 control-label label-form">网站状态:</label>-->
                    <!--<label class="checkbox-inline">-->
                        <!--<input type="radio" name="setting_site_status"  value="1" <if condition="$list['setting_site_status']['data'] eq '1'"> checked="checked" </if>>启用-->
                    <!--</label>-->
                    <!--<label class="checkbox-inline">-->
                        <!--<input type="radio" name="setting_site_status" value="0"  <if condition="$list['setting_site_status']['data'] eq '0'"> checked="checked" </if>>关闭-->
                    <!--</label>-->
                <!--</div>-->

                <!--<div class="form-group">-->
                    <!--<label class="col-sm-1 control-label label-form">开放注册:</label>-->
                    <!--<label class="checkbox-inline">-->
                        <!--<input type="radio" name="setting_member_register" value="1" <if condition="$list['setting_member_register']['data'] eq '1'"> checked="checked" </if>> 启用-->
                    <!--</label>-->
                    <!--<label class="checkbox-inline">-->
                        <!--<input type="radio" name="setting_member_register" value="0" <if condition="$list['setting_member_register']['data'] eq '0'"> checked="checked" </if>> 关闭-->
                    <!--</label>-->
                <!--</div>-->

                <div class="form-group">
                    <label class="col-sm-1 control-label label-form">备案信息:</label>
                    <div class="col-sm-3 input-padding">
                        <input type="text" class="form-control" value="{$list.setting_site_mark.data}" name="setting_site_mark" id="setting_site_mark"
                               placeholder="请输入网站备案信息">
                    </div>
                </div>

                <!--<div class="form-group">-->
                    <!--<label class="col-sm-1 control-label label-form">站长邮箱:</label>-->
                    <!--<div class="col-sm-3 input-padding">-->
                        <!--<input type="text" class="form-control" value="{$list.setting_admin_email.data}" name="setting_admin_email" id="setting_admin_email"-->
                               <!--placeholder="请输入站长邮箱">-->
                    <!--</div>-->
                <!--</div>-->

                <!--<div class="form-group">-->
                    <!--<label class="col-sm-1 control-label label-form">统计代码:</label>-->
                        <!--<div class="col-sm-3 input-padding">-->
                            <!--<textarea class="form-control" rows="3" name="setting_count_code" placeholder="请输入统计代码">{$list.setting_count_code.data}</textarea>-->
                        <!--</div>-->
                <!--</div>-->

                <!--<div class="form-group">-->
                    <!--<label class="col-sm-1 control-label label-form">版权信息:</label>-->
                    <!--<div class="col-sm-3 input-padding">-->
                        <!--<textarea class="form-control" name="setting_copy_right" rows="3" placeholder="请输入版权信息">{$list.setting_copy_right.data}</textarea>-->
                    <!--</div>-->
                <!--</div>-->

                <div class="form-group">
                    <button class="btn btn-primary btn-position setting-btn">保存</button>
                </div>

            </form>

        </div>
    </div>
    <div class="tab-pane fade" id="con2">
        <div style="margin-top: 20px;">
            <form class="form-horizontal" role="form" id="setting_email_form" action="{:u('superadmin/settings/index')}" method="post">

                <div class="form-group">
                    <label class="col-sm-1 control-label label-form">smtp服务器:</label>
                    <div class="col-sm-3 input-padding">
                        <input type="text" class="form-control" value="{$list.setting_email_host.data}" name="setting_email_host"
                               placeholder="请输入smtp服务器">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-1 control-label label-form">发件地址:</label>
                    <div class="col-sm-3 input-padding">
                        <input type="text" class="form-control" value="{$list.setting_email_username.data}" name="setting_email_username"
                               placeholder="请输入发件人地址 如 admin@admin.com">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-1 control-label label-form">邮箱密码:</label>
                    <div class="col-sm-3 input-padding">
                        <input type="text" class="form-control" value="{$list.setting_email_password.data}" name="setting_email_password"
                               placeholder="请输入邮箱密码">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-1 control-label label-form">邮件编码:</label>
                    <div class="col-sm-3 input-padding">
                        <input type="text" class="form-control" value="{$list.setting_email_charset.data}" name="setting_email_charset"
                               placeholder="请输入邮件编码">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-1 control-label label-form">发件人姓名:</label>
                    <div class="col-sm-3 input-padding">
                        <input type="text" class="form-control" value="{$list.setting_email_from.data}" name="setting_email_from"
                               placeholder="请输入发件人姓名">
                    </div>
                </div>

                <div class="form-group">
                    <button class="btn btn-primary btn-position setting-btn">保存</button>
                </div>

                </form>

            <form class="form-horizontal" role="form">
            <div class="form-group">
                <label class="col-sm-1 control-label label-form">测试邮件:</label>
                <div class="col-sm-3 input-padding">
                    <input type="text" class="form-control" name="test_email" id="test_email"
                           placeholder="请输入测试邮件">
                </div>
                <button id="send_email" class="btn btn-success">发送邮件</button>
            </div>
            </form>
        </div>
    </div>
    <div class="tab-pane fade" id="con3">
        <div style="margin-top: 20px;">
            <form class="form-horizontal" role="form" id="setting_company_form" action="{:u('superadmin/settings/index')}" method="post">

                <div class="form-group">
                    <label class="col-sm-1 control-label label-form">首页视频:</label>
                    <div class="col-sm-3 input-padding">
                        <input type="text" class="form-control" value="{$list.setting_home_video.data}" name="setting_home_video"
                               placeholder="请输入视频链接 尺寸: 382 * 288">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-1 control-label label-form">公司电话:</label>
                    <div class="col-sm-3 input-padding">
                        <input type="text" class="form-control" value="{$list.setting_company_tel.data}" name="setting_company_tel"
                               placeholder="请输入公司电话">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-1 control-label label-form">公司邮箱:</label>
                    <div class="col-sm-3 input-padding">
                        <input type="text" class="form-control" value="{$list.setting_company_email.data}" name="setting_company_email"
                               placeholder="请输入公司邮箱 eg:company@admin.com">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-1 control-label label-form">公司地址:</label>
                    <div class="col-sm-3 input-padding">
                        <input type="text" class="form-control" value="{$list.setting_company_addr.data}" name="setting_company_addr"
                               placeholder="请输入公司地址">
                    </div>
                </div>

                <div class="form-group">
                    <button class="btn btn-primary btn-position setting-btn">保存</button>
                </div>

            </form>

        </div>
    </div>
</div>


<include file="public:footer" />
<script>
    $(document).ready(function(){
        $('#mytab a').click(function (e) {
            e.preventDefault()
            $(this).tab('show')
        })

        $('.setting-btn').click(function(){
            var form_id = $(this).parents('form').prop('id');
            //数据验证
            $.ajax({
                type: "POST",
                url: $('#'+form_id).attr('action'),
                data: $('#'+form_id).serialize(),
                dataType: "json",
                success:function(data){
                    if(data.status)
                    {
                        layer.msg(data.msg,{offset:[150],icon: 1,time:2000, shade: [0.1, '#ccc']});
                    } else {
                        layer.msg(data.msg,{offset:[150],icon: 2,time:2000, shade: [0.1, '#ccc']})
                    }

                }
            });
            return false;
        });

        //发送测试邮件
        $('#send_email').click(function(){
            var url = "{:u('superadmin/settings/email_test')}";
            $.post(url,{email: $.trim($('#test_email').val())},function(res){
                layer.msg(res.msg,{time:2000,offset:[150]});
            },'json')
            return false;
        });



    });
</script>
</body>
</html>